<main>
<?php
    if (!isset($_SESSION['IDupd'])) {
        include($root . "/teacher/pageParts/questionToggle.php");
    } else {
        $ID = $_SESSION['IDupd'];
        $sql = "SELECT * FROM questions WHERE questionID = '$ID'";
        $result = mysqli_query($db, $sql);
        $row = mysqli_fetch_assoc($result);

        $question = $row['questionDescription'];
        $correctPoints = $row['correctPoints'];
        $wrongPoints = $row['assHolePoints'];      
        $answer = $row['answerTrueFalse'];
    } ?>
  <div class="form">
    <form action="/teacher/logic/formLogic.php" method="POST">

      <label for="question">Question</label>
      <input type="text" id="question" name="question" placeholder="question text.." <?php if(isset($question)){echo "value = '$question'";}?> required>

      <label for="addPoints">Points for correct answer (0-10)</label>
      <input type="number" id="addPoints" name="addPoints" step="0.01" min="0" max="10" <?php if(isset($correctPoints)){echo "value = '$correctPoints'";}?> required><br>

      <label for="cutPoints">Minus points for wrong answer (0-10)</label>
      <input type="number" id="cutPoints" name="cutPoints" step="0.01" min="0" max="10" <?php if(isset($wrongPoints)){echo "value = '$wrongPoints'";}?> required><br><br>

      <input type="radio" name="answerTrueFalse" value="T" id="true" <?php if(isset($answer)){if($answer == 'T'){echo 'checked';}}else{echo 'checked';}?> />
      <label for="true">True</label>
      <input type="radio" name="answerTrueFalse" value="F" id="false" <?php if(isset($answer)){if($answer == 'F'){echo 'checked';}}?>/>
      <label for="false">False</label>

      <input type="submit" value="Submit">
    </form>
  </div>
</main>